// import { Header } from '@/api/interface/index';
import { PORT1 } from '@/api/config/servicePort';
import { ResPage, User } from '@/api/interface/index';
import http from '@/api';
const url = `${PORT1}/sys/`;

// 用户管理
export const getUserList = (params: User.ReqGetUserParams) => {
	return http.get<ResPage<User.ResUserList>>(`${url}user/list`, params);
};

// * 新增用户
export const addUser = (params: User.SaveUser) => {
	return http.post(`${url}user/save`, params);
};

// * 批量删除用户
export const deleteUserBatch = (id: number[]) => {
	return http.post(`${url}user/delete`, id);
};

// * 编辑用户
export const editUser = (params: { id: string }) => {
	return http.post(`${url}user/update`, params);
};

// 获取用户信息
export const getUserInfo = (id: number) => {
	return http.get(`${url}user/info/${id}`, {}, {});
};

// 角色管理
// * 获取用户角色
export const getRoleList = (params?: any) => {
	return http.get(`${url}role/list`, params, {});
};

// * 获取角色选择列表
export const getRoleSelectList = () => {
	return http.get(`${url}role/select`, {}, {});
};

// * 新增角色
export const addRole = (params: any) => {
	return http.post(`${url}role/save`, params);
};

// * 批量删除角色
export const deleteRoleBatch = (id: number[]) => {
	return http.post(`${url}role/delete`, id);
};

// * 编辑角色
export const editRole = (params: any) => {
	return http.post(`${url}role/update`, params);
};

// * 获取角色详情
export const getRoleInfo = (id: number) => {
	return http.get(`${url}role/info/${id}`, {}, {});
};

// 菜单管理
// * 获取菜单列表
export const getMenuList = (params?: any) => {
	return http.get(`${url}menu/list`, params, {});
};

// 新增
export const addMenu = (params: any) => {
	return http.post(`${url}menu/save`, params);
};

// 编辑
export const editMenu = (params: any) => {
	return http.post(`${url}menu/update`, params);
};

// 删除
export const deleteMenu = (id: number) => {
	return http.post(`${url}menu/delete/${id}`);
};

// 获取菜单详情
export const getMenuInfo = (id: number) => {
	return http.get(`${url}menu/info/${id}`, {}, {});
};

// 获取菜单选择列表
export const getMenuSelectList = () => {
	return http.get(`${url}menu/select`, {}, {});
};

// 日志管理
// * 获取日志列表
export const getLogList = (params?: any) => {
	return http.get(`${url}log/list`, params, {});
};

// 参数管理
// * 获取参数列表
export const getParaList = (params?: any) => {
	return http.get(`${url}config/list`, params, {});
};

// * 新增参数
export const addPara = (params: any) => {
	return http.post(`${url}config/save`, params);
};

// * 编辑参数
export const editPara = (params: any) => {
	return http.post(`${url}config/update`, params);
};

// * 批量删除参数
export const deleteParaBatch = (id: number[]) => {
	return http.post(`${url}config/delete`, id);
};

// 文件管理
// * 获取文件列表
export const getFileList = (params?: any) => {
	return http.get(`${url}oss/list`, params, {});
};

// * 新增文件
export const saveConfig = (params: any) => {
	return http.post(`${url}oss/saveConfig`, params);
};

// * 批量删除文件
export const deleteFileBatch = (id: number[]) => {
	return http.post(`${url}oss/delete`, id);
};

// * 获取oss配置
export const getOssConfig = () => {
	return http.get(`${url}oss/config`, {}, {});
};
